package cn.com.nes.site.controller.crm.customer.vo;

import cn.com.nes.site.entity.em.crm.customer.CustomerFileTypeEnum;
import cn.com.nes.site.entity.vo.BaseVO;
import cn.com.nes.site.service.crm.customer.bo.CustomerFileBO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import javax.validation.constraints.NotNull;

@ApiModel(value = "客户文件保存入参模型")
@Data
public class CustomerFileSaveVO extends BaseVO {

    @ApiModelProperty(value = "客户文件ID")
    private Long id;

    @ApiModelProperty(value = "客户UUID", required = true)
    @NotNull(message = "客户UUID")
    private String customerUuid;

    @ApiModelProperty(value = "文件类型", required = true)
    @NotNull(message = "文件类型")
    private String fileType;

    @ApiModelProperty(value = "文件名称", required = true)
    @NotNull(message = "文件名称")
    private String fileName;

    @ApiModelProperty(value = "文件路径", required = true)
    @NotNull(message = "文件路径")
    private String filePath;

    @ApiModelProperty(value = "备注")
    private String memo;

    public CustomerFileBO convertToBo() {
        CustomerFileBO customerFileBo = new CustomerFileBO();
        BeanUtils.copyProperties(this, customerFileBo);
        customerFileBo.setCustomerFileType(CustomerFileTypeEnum.getEnum(fileType));
        return customerFileBo;
    }
}
